/* Popovers/Menus */

$popop_menuitem_radius: $wm_radius - 4px;

//.the popover itself
.popup-menu-boxpointer {
  -arrow-border-radius: 2px;
  -arrow-background-color: transparent;
  -arrow-border-width: 0;
  -arrow-border-color: transparent;
  -arrow-base: 64px;
  -arrow-rise: 0;
  -arrow-box-shadow: none; //dreaming. bug #689995
  background: transparent; // needs to reset?
}

// container of the popover menu
.popup-menu {
  min-width: 12em;
  color: $alt_fg_color;
  padding: 0 0 !important;
  @include font(body-1);

  .popup-menu-content {
    padding: 6px 0 !important;
    @extend %theme_dialogs;
    box-shadow: 0 8px 16px 0 rgba(black, 0.25);
    border: 1px solid if($variant=='light', rgba(black, 0), rgba(black, 0.75));
    margin: 4px 8px 4px 12px !important;
    @include font(body-1);
  }

  .popup-menu-item {
    spacing: $base_spacing * 2;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
    color: $alt_fg_color;
    text-shadow: none;
    border-radius: $popop_menuitem_radius;
    margin: 0 6px;
    font-weight: normal;

    &:ltr { padding-right: 2em !important; padding-left: 0 !important; }
    &:rtl { padding-right: 0 !important; padding-left: 2em !important; }

    &:checked {
      font-weight: normal;
      border-radius: $popop_menuitem_radius $popop_menuitem_radius 0 0;
      border: none;
      box-shadow: none;
      color: $alt_fg_color;
      background-color: $submenu_bg_color;

      &.hover, &.selected {
        color: $selected_fg_color;
        background-color: $selected_bg_color;
      }

      &:active {
        color: $selected_fg_color;
        background-color: mix($fg_color, $selected_bg_color, 5%);
      }

      &:insensitive { color: $disabled_fg_color; }
    }

    &.selected {
      color: $selected_fg_color;
      background-color: $selected_bg_color;
    }

    &:active, &.selected:active {
      color: $selected_fg_color;
      background-color: mix($fg_color, $selected_bg_color, 5%);
    }

    &:insensitive { color: $disabled_fg_color; }
  }

  .popup-sub-menu {
    background-color: $submenu_bg_color;
    border-radius: 0 0 $popop_menuitem_radius $popop_menuitem_radius;
    border: none;
    box-shadow: none;
    margin: 0 6px;

    .popup-menu-item {
      margin: 0;
      border-radius: $popop_menuitem_radius;

      &:hover {
        color: $selected_fg_color;
        background-color: $selected_bg_color;
      }

      &:active {
        color: $selected_fg_color;
        background-color: mix($fg_color, $selected_bg_color, 5%);
      }

      &:not(:first-child):last-child {
        border-radius: 0 0 $popop_menuitem_radius $popop_menuitem_radius;
      }
    }
  }

  .popup-inactive-menu-item { //all icons and other graphical elements
    color: $alt_fg_color;

    &:insensitive { color: $disabled_fg_color; }
  }

  //.popup-status-menu-item { font-weight: normal;  color: pink; } //dunno what that is
  &.panel-menu {
    -boxpointer-gap: $base_margin; // distance from the panel
    margin-bottom: 1.75em;
  }

  StEntry {
    selection-background-color: $light_alt_fg_color;
    selected-background-color: $light_alt_fg_color;
    selected-color: $primary_color;
    caret-color: $fg_color;

    StLabel.hint-text {
      margin-left: 2px;
      color: transparentize($fg_color, 0.3);
    }
  }
}
// symbolic icons in popover
.popup-menu-arrow,
.popup-menu-icon { icon-size: $base_icon_size; }

// container for radio and check boxes
.popup-menu-ornament {
  width: 1.2em;

  &:ltr { text-align: right };
  &:rtl { text-align: left };
}

// separator
.popup-separator-menu-item {
  margin: 0 0;
  padding: 0 0;
  background: none;
  border: none;
  height: 1px;

  .popup-separator-menu-item-separator {
    height: 1px; //not really the whole box
    margin: 0 0;
    background-color: $borders_color;
    padding: 0 0;

    .popup-sub-menu & { //submenu separators
      padding: 0 0;
      margin: 0 32px 0 0;
      height: 1px;
    }
  }
}

// desktop background menu
.background-menu {
  -boxpointer-gap: $base_margin;
  -arrow-rise: 0px; // hide the beak on the menu
}

// system status popover menu
.aggregate-menu {
  min-width: 21em;

  // lock screen, shutdown, etc. buttons
  .popup-menu-icon {
    padding: 0;
    margin: 0 0;
    -st-icon-style: symbolic;
  }

  .popup-sub-menu .popup-menu-item > :first-child {
    &:ltr { /* 12px spacing + 2*4px padding */
            padding-left: $base_padding * 2 + 4px; margin-left: 1em; }
    &:rtl { /* 12px spacing + 2*4px padding */
            padding-right: $base_padding * 2 + 4px; margin-right: 1em; }
  }
}
